{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Solution:\n",
    "    def merge(self, nums1: [int], m: int, nums2: [int], n: int) -> None:\n",
    "        \"\"\"\n",
    "        Do not return anything, modify nums1 in-place instead.\n",
    "        \"\"\"\n",
    "        while m > 0 and n > 0:\n",
    "            if nums1[m-1] > nums2[n-1]:\n",
    "                nums1[m+n-1] = nums1[m-1]\n",
    "                m = m - 1\n",
    "            else:\n",
    "                nums1[m+n-1] = nums2[n-1]\n",
    "                n = n - 1\n",
    "        while n > 0:\n",
    "            nums1[n-1] = nums2[n-1]\n",
    "            n = n - 1\n",
    "        return None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[4, 5, 6]\n"
     ]
    }
   ],
   "source": [
    "s = Solution()\n",
    "s.merge([1,2,3], 0, [4,5,6], 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
